#pragma once

#include <google/protobuf/service.h>
#include <google/protobuf/message.h>
#include <google/protobuf/descriptor.h>

#include "TcpConnectionPool.h"

class RpcClient : public google::protobuf::RpcChannel
{
public:
    RpcClient(int pool_size = 20) {
        m_tcp_conn_pool = new TcpConnectionPool(pool_size);
    }

    void CallMethod(const google::protobuf::MethodDescriptor *method,
                    google::protobuf::RpcController *controller, 
                    const google::protobuf::Message *request,
                    google::protobuf::Message *response, 
                    google::protobuf::Closure *done);

    ~RpcClient() {
        delete m_tcp_conn_pool;
    }
private:
    TcpConnectionPool *m_tcp_conn_pool;
};